package com.brillilab.service.module.message.template.impl.usercenter;

import com.alibaba.fastjson.JSONObject;
import com.brillilab.service.module.message.template.AbstractMessageTemplate;
import com.brillilab.service.module.message.template.enums.MessageTypeEnum;

/**
 * @author zlb
 * @Title: ReCallLabTemplate
 * @ProjectName brill_lab
 * @Description: 用户被召回实验室后
 * @date 2019/5/27 11:34
 */
public class ReCallLabTemplate extends AbstractMessageTemplate {
    private String labName;
    private String operator;

    /**
     * 用户被召回实验室后
     * @param labId 实验ID
     * @param receiverId 接收人ID
     * @param labMemberId 接收者实验室成员Id
     * @param labName    实验室名称
     * @param operator   操作人
     */
    public ReCallLabTemplate(Long labId,Long receiverId,Long labMemberId,String labName,String operator) {
        super(labId,receiverId);
        super.setType(MessageTypeEnum.ReCallLab.getValue());
        super.setTitle("您已被召回实验室");
        String content=String.format(
                        "<span>你已被</span>" + "<span style='color:#F6AC2D'>%s</span>" +
                        "<span>召回至</span>" + "<span style='color:#F6AC2D'>%s</span>" +
                        "<span>，如有疑问请联系实验室管理员</span>"
                ,operator,labName);
        super.setContent(content);
        super.setAppContent(String.format(
                "你已被%s召回至%s，如有疑问请联系实验室管理员",operator,labName));
        this.labMemberId=labMemberId;
        this.labName=labName;
        this.operator=operator;
    }

    @Override
    public String getJsonData() {
        JSONObject object=new JSONObject();
        object.put("pushType",MessageTypeEnum.ReCallLab.getName());
        object.put("labMemberId",labMemberId);
        object.put("labName",labName);
        object.put("operator",operator);
        object.put("content",appContent);
        return object.toJSONString();
    }

}
